<!DOCTYPE html>
<html>
      <meta charset=utf-8 />
      <title>点击事件</title>
    <head>
 <style>
   #div0{
     width: 200px;
     height: 200px;
     background-color: skyblue;
   }
 </style>
  </head>
<body>
		<button>按钮</button>
        <div id="div0">div</div>
				<script>
					var But=document.getElementsByTagName("button")[0];
					var oDiv=document.getElementsByTagName("div")[0];
					But.onclick=function(e){                  //点击出现
						 oDiv.style.display="block";
						 e.stopPropagation();         //阻止冒泡
					}
					// 点击空白消失
					document.onclick=function(e){
						oDiv.style.display="none";
					}
				</script>
 </body>
</html>